package com.liusr.template.mq.producer;

import com.liusr.template.constant.MQExchangeName;
import com.liusr.template.constant.MQRoutingKeyName;
import com.liusr.template.vo.NotifyMsgSendVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author Liusr
 * @date 2023/3/14
 * @package com.liusr.template.mq.producer
 * @Description: MQ producer生产者
 */
@Slf4j
@Component
public class NotifyMsgProducer {

	@Resource
	private RabbitTemplate rabbitTemplate;

	public void send(NotifyMsgSendVO notifyMsgSendVO) {
		log.debug("客需任务-生产消息【{}】", notifyMsgSendVO);
		this.rabbitTemplate.convertAndSend(MQExchangeName.NOTIFY_MSG.name(),
				MQRoutingKeyName.NOTIFY_MSG.name(), notifyMsgSendVO);
	}
}
